<%@ include file="../system/HeaderStrutsForm.jsp" %>
<html>
  <head>

    <bean:message key="page.css"/>
    <bean:message key="page.script"/>
  </head>
  <center>
    <body>
      <table class="mainTable" style='width:99%;'>
        <tr>
          <td>
            <%
            {
              %>
              <form class="baseForm" >
                <table class="bannerTable" style=width:99%;>
                  <tr>
                    <td class="tableHeader">
                      Lista de Urls
                    </td>
                  </tr>
                </table>
                <table 
                    id="TRbl_report_Url"
                    class="reportTable"
                    style=width:99%;
                     >

                  <%
                  int counterbl_report_Url=0;
                  %>
                  <%
                  {
                    br.com.werp.suporte.dbobj.table.Url t_url = new br.com.werp.suporte.dbobj.table.Url();
                    java.util.Vector res_Url = null;
                    com.egen.util.jdbc.JdbcUtil j = null;
                    try {
                      j = new com.egen.util.jdbc.JdbcUtil();
                      String[][] select =  null;
                      Object[][] where = null;
                      String[] groupby =  null;
                      String[] having =  null;
                      String[] order = {"url_path"};
                      res_Url = j.select(t_url,select,where,groupby,having,order);
                    } catch (Exception e){
                      session.setAttribute("exception",com.egen.util.system.Error.getDescription(e));
                      %>
                      <jsp:forward page="/system/ErrorPage.jsp"/>
                      <%
                    } finally {
                    if(j!=null){j.close();}
                  }
                  if (res_Url!=null && res_Url.size()>0) {
                    if ( ((String)request.getParameter("_ordered"))!=null && ((String)request.getParameter("_ordered")).length()>0 ) {
                      boolean reverse = false;
                      if ( ((String)request.getParameter("_reverse"))!=null && ((String)request.getParameter("_reverse")).length()>0 && ((String)request.getParameter("_reverse")).equals("true") ){
                        reverse = true;
                      }
                      try {
                        res_Url = com.egen.util.text.Sort.execute(res_Url,((String)request.getParameter("_ordered")),reverse);
                      } catch (Exception e) {}
                    }
                    int url_id =  0;
                    java.lang.String url_path =  null;
                    int i_bl_report_Url = 0;
                    t_url = (br.com.werp.suporte.dbobj.table.Url)res_Url.elementAt(i_bl_report_Url);
                    url_id = t_url.getUrl_id();
                    url_path = t_url.getUrl_path()==null?"":t_url.getUrl_path();
                    %>
                    <tr class="reportHeader" >
                      <td >
                        <span 
                            class="spamHeaderLabel"
                            style="text-align:left;width:100%;">

                          Url Path
                        </span>
                      </td>
                    </tr>
                    <%
                    while (i_bl_report_Url<res_Url.size()){
                      counterbl_report_Url++;
                      String style="";
                      if (!((i_bl_report_Url%2)!=0)) {
                        style="class=rowColor";
                      } else {
                        style="class=rowBlank";
                      }
                      %>
                      <tr 
                          <%=
                          style
                          %>
                          id='TRbl_report_Url<%=counterbl_report_Url%>'
                      >

                        <td class="reportcolumn"  >
                          <a 
                              href="javascript:setLov('<%= url_id %>','<%= url_path %>')"
                              target="_self"
                              STYLE="cursor:hand">


                            <span 
                                class="spamColumnLabel"
                                style="text-align:left;">

                              <%= url_path %>
                            </span>
                          </a>
                        </td>
                      </tr>
                      <%
                      if (++i_bl_report_Url >= res_Url.size()) {
                        break;
                      }
                      t_url = (br.com.werp.suporte.dbobj.table.Url)res_Url.elementAt(i_bl_report_Url);
                      url_id = t_url.getUrl_id();
                      url_path = t_url.getUrl_path()==null?"":t_url.getUrl_path();
                    }
                  }
                }
                %>
              </table>
              <script>
                function setLov(URL_ID,URL_PATH) {
                  <% { String returnBlock = ((request.getParameter("returnBlock")!=null)?request.getParameter("returnBlock"):(String)session.getAttribute("returnBlock_bl_report_Url"));
                  if (returnBlock!=null && returnBlock.length()>0) {
                    session.setAttribute("returnBlock_bl_report_Url",returnBlock);%>
                    returnBlock = <%= returnBlock %>;
                    <% } else { %>
                    returnBlock = 0;
                    <% } } %>
                    <% { String return0 = ((request.getParameter("return0")!=null)?request.getParameter("return0"):(String)session.getAttribute("return0_bl_report_Url"));
                    if (return0!=null && return0.length()>0) {
                      session.setAttribute("return0_bl_report_Url",return0);%>
                      if (opener.document.forms[returnBlock].<%= return0 %>!=null) { opener.document.forms[returnBlock].<%= return0 %>.value=URL_ID };
                      <% } else { %>
                      if (opener.document.forms[returnBlock].url_id!=null) { opener.document.forms[returnBlock].url_id.value=URL_ID };
                      <% } } %>
                      <% { String return1 = ((request.getParameter("return1")!=null)?request.getParameter("return1"):(String)session.getAttribute("return1_bl_report_Url"));
                      if (return1!=null && return1.length()>0) {
                        session.setAttribute("return1_bl_report_Url",return1);%>
                        if (opener.document.forms[returnBlock].<%= return1 %>!=null) { opener.document.forms[returnBlock].<%= return1 %>.value=URL_PATH };
                        <% } else { %>
                        if (opener.document.forms[returnBlock].url_path!=null) { opener.document.forms[returnBlock].url_path.value=URL_PATH };
                        <% } } %>
                        window.close();
                      }
                    </script>
                  </form>
                  <%
                }
                %>
              </td>
            </tr>
          </table>
        </body>
      </center>
    </html>
